﻿CREATE PROCEDURE [dbo].[yaf_watchtopic_add](
                @UserID  INT,
                @TopicID INT)
AS
    BEGIN
        INSERT INTO yaf_WatchTopic
                   (TopicID,
                    UserID,
                    Created)
        SELECT @TopicID,
               @UserID,
               Getdate()
        WHERE  NOT EXISTS (SELECT 1
                    FROM   yaf_WatchTopic
                    WHERE  TopicID = @TopicID
                    AND UserID = @UserID)
    END


